﻿package smooth.core.object.desktopCanvasComponent {
	import app.core.action.RotatableScalable;
	import flash.display.DisplayObject;
	import flash.display.Shape;
	import flash.display.Sprite;
	import flash.geom.Point;
	import flash.filters.*;
	import flash.events.*;
	import flash.geom.Rectangle;
	import flash.utils.Timer;
	import flash.events.TimerEvent;
	import smooth.core.canvas.gridCanvas.GridCanvas;
	import smooth.core.object.desktopComponent.DesktopComponent;
	import smooth.core.object.googleMapComponent.GoogleMapComponent;
	import smooth.core.object.flickrComponent.FlickrComponent;
	import smooth.core.object.youTubeComponent.YouTubeComponent;
	
	public class DesktopCanvasComponent extends GridCanvas {	
		private var initialWidth:int;
		private var initialHeight:int;
		private var initialPosX:int;
		private var initialPosY:int;
		private var initialColor:int;
		private var initialAlpha:Number;
		public var desktopMask:Rectangle;
				
		public function DesktopCanvasComponent(posX:int, posY:int, sizeX:int, sizeY:int, color:int, alpha:Number)	{
			// Init des attributs de l'objet
			this.initialPosX = posX;
			this.initialPosY = posY;
			this.initialWidth = sizeX;
			this.initialHeight = sizeY;
			this.initialColor = color;
			this.initialAlpha = alpha;
			// Constructeur parent
			super(posX, posY, sizeX, sizeY, color, alpha);
			// Init des visuels du composant			
			initGraphics();
			// Init des events du composant
			initEvents();	
			// Init des process du composant
			initProcess();
		}	
		
		private function initGraphics():void {
			this.x = this.initialPosX;
			this.y = this.initialPosY;
		}
			
		private function initProcess():void {
			initDesktopComponent(70, this.initialHeight/6);
			initGoogleMapComponent(70, 2*this.initialHeight/6);
			initYouTubeComponent(70, 3*this.initialHeight/6);
			initFlickrComponent(70, 4*this.initialHeight/6);
		}
		
		private function initEvents():void {
		}
		
		private function initDesktopComponent(posX:int, posY:int):void {
			var desktop1:DesktopComponent = new DesktopComponent();
			this.addChild(desktop1);
			desktop1.x = posX;
			desktop1.y = posY;
		}
		
		private function initFlickrComponent(posX:int, posY:int):void {
			var flickr1:FlickrComponent = new FlickrComponent();
			this.addChild(flickr1);
			flickr1.x = posX;
			flickr1.y = posY;
		}
		
		private function initYouTubeComponent(posX:int, posY:int):void {
			var youTube1:YouTubeComponent = new YouTubeComponent();
			this.addChild(youTube1);
			youTube1.x = posX;
			youTube1.y = posY;
		}
		
		private function initGoogleMapComponent(posX:int, posY:int):void {
			var googleMap1:GoogleMapComponent = new GoogleMapComponent();
			this.addChild(googleMap1);
			googleMap1.x = posX;
			googleMap1.y = posY;
		}
		
	}
}

